var o = require;
var t = module;
cc.Class({
    extends: cc.Component,
    properties: {pbRUWord: cc.Prefab},
    start: function start() {
        (this.defPos = this.node.position.clone()),
            this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this),
            (this.localLogicPos = []);
    },
    onTouchStart: function onTouchStart(o, t) {
        this.canMove && this.rwMain && this.rwMain.ruWordsTouchStart(this, o, t);
    },
    setContent: function setContent(o, t, s, r) {
        void 0 === t && (t = !0),
            void 0 === s && (s = 80),
            void 0 === r && (r = 5),
            (this.canMove = t),
            (this.ruwords = []),
            (this.strs = o);
        var i = s + r;
        (this.node.height = this.strs.length * i), (this.node.width = this.strs[0].length * i);
        for (var e = -this.node.width / 2 + s / 2, n = this.node.height / 2 - s / 2, h = 0; h < this.strs.length; h++) {
            for (var d = 0; d < this.strs[h].length; d++) {
                if (this.strs[h][d] && "//" != this.strs[h][d]) {
                    var u = cc.instantiate(this.pbRUWord);
                    (u.parent = this.node), (u.x = e + d * i), (u.y = n - h * i);
                    var c = u.getComponent("RuWord");
                    (c.label.string = this.strs[h][d]), this.ruwords.push(c);
                }
            }
        }
    },
    setMaskColor: function setMaskColor(o) {
        for (var t = new cc.Color().fromHEX(o), s = 0; s < this.ruwords.length; s++) {
            this.ruwords[s].node.color = t;
        }
    },
    getLocalLogicPos: function getLocalLogicPos() {
        for (var o = [], t = 0; t < this.strs.length; t++) {
            o[t] = [];
            for (var s = 0; s < this.strs[t].length; s++) {
                this.strs[t][s] && "//" != this.strs[t][s] ? (o[t][s] = cc.v2(t, s)) : (o[t][s] = null);
            }
        }
        return o;
    },
    getLogicPoses: function getLogicPoses(o, t, s, r, i) {
        for (var e = [], n = 0; n < this.ruwords.length; n++) {
            e.push(this.ruwords[n].getLogicPos(o, t, s, r, i));
        }
        return e;
    }
});
